package cn.lpz.controller;

import cn.lpz.dao.IAccountDao;
import cn.lpz.domian.Account;
import cn.lpz.service.AccountServiceimpl;
import cn.lpz.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * web账户 控制器
 */
@Controller
@RequestMapping("account")
public class AccountContrller {
    @Autowired
    private IAccountService iAccountService;
    @Autowired
    IAccountDao iAccountDao;
    @RequestMapping("testSpringmvc")
    public String testSpringmvc(Model model){
        System.out.println(".......成功");
        iAccountService.findAll();//有无监听器，均可成功
        List<Account> all = iAccountDao.findAll();
        model.addAttribute("success",all);
        return "success";
    }
    @RequestMapping("testsaveaccount")
    public  String Test(Account account){
        iAccountDao.saveAccount(account);
        return "success";
    }

}
